From 7b3372ad384291d3994ae4626f15c7692d0c3094 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Tue, 22 Aug 2017 20:56:32 +0100 Subject: Use target_compile_options instead of variables to add -fomit-frame-pointer to mbedtls --- CMakeLists.txt | 6 ++++++ SetFlags.cmake | 7 ------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 124169ddd..1b92ca8e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -277,6 +277,12 @@ endif() # (PolarSSL also has test and example programs in their CMakeLists.txt, we don't want those) include(lib/polarssl.cmake EXCLUDE_FROM_ALL) +if(NOT MSVC AND "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm") + # mbed TLS uses the frame pointer's register in inline assembly: + # https://tls.mbed.org/kb/development/arm-thumb-error-r7-cannot-be-used-in-asm-here + target_compile_options(mbedtls PUBLIC -fomit-frame-pointer) +endif() + set_exe_flags() add_subdirectory(src) diff --git a/SetFlags.cmake b/SetFlags.cmake index e0eb05ef1..d072d1aad 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -107,13 +107,6 @@ macro(set_flags) ) endif() - if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm") - # mbed TLS uses the frame pointer's register in inline assembly: - # https://tls.mbed.org/kb/development/arm-thumb-error-r7-cannot-be-used-in-asm-here - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fomit-frame-pointer") - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fomit-frame-pointer") - endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11") set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -std=c++11") -- cgit v1.2.3